#include <QtCore>
#include <QCoreApplication>

#include "SwitchStatus.h"

QString gswitchType;
QString gswitchAddr="0.0.0.0";

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    qWarning()<<"Starting SwitchManager";

    QString arg;
	for(int i=0;i<argc;i++)
	{
		arg.clear();
		arg.append(argv[i]);
		arg.remove(QChar('-'));

		if(arg.contains("IP"))
		{
			int subIndex=arg.indexOf(QChar('='));
			gswitchAddr=arg.mid(subIndex+1);
		}
		else if(arg.contains("Type"))
		{
			int subIndex=arg.indexOf(QChar('='));
			gswitchType=arg.mid(subIndex+1);
		}
	}
	
	if(gswitchAddr=="0.0.0.0")
	{
		qWarning()<<"Invalid switch address,exit now";
		return 0;
	}

	SwitchStatus *statusThr=new SwitchStatus;
	statusThr->start();

    return a.exec();
}
